package com.corgi.mybatis.base;

import java.util.Optional;

/**
 * @title: DefaultEncryptFieldStrategy
 * @description: 默认字符串加密策略 只处理字符串将其反转
 * @author: dengmiao
 * @create: 2019-10-18 09:46
 **/
public class DefaultStringFieldEncryptStrategy implements EncryptFieldStrategy<String> {

    @Override
    public String encrypt(String source) {
        return Optional.of(source).map(s -> new StringBuffer(s).reverse().toString()).orElse(null);
    }
}
